autoconf: check for wget and ftp
authorRoger Pau Monne <roger.pau@citrix.com>
Tue, 30 Oct 2012 18:11:02 +0000 (18:11 +0000)
committerRoger Pau Monne <roger.pau@citrix.com>
Tue, 30 Oct 2012 18:11:02 +0000 (18:11 +0000)
Some OSes don't come with wget by default, so ftp should be choosen
on those. Add an autoconf check to check for wget and ftp, and
replace the usage of hardcoded wget in tools.

[ Stubdom builds still use wget unconditionally. -iwj ]

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Signed-off-by: Roger Pau Monne <roger.pau@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
config/StdGNU.mk
config/Tools.mk.in
tools/configure
tools/configure.ac
tools/firmware/etherboot/Makefile

index b6adbbe42238bcb118a82f0d9cd8ccd83ff3e5bd..3febe8dc284f90d63d9a288b5b2ebe525fa7f263 100644 (file)
@@ -22,8 +22,6 @@ MSGMERGE   = msgmerge
 # Allow git to be wrappered in the environment
 GIT        ?= git
 
-WGET       ?= wget -c
-
 INSTALL      = install
 INSTALL_DIR  = $(INSTALL) -d -m0755 -p
 INSTALL_DATA = $(INSTALL) -m0644 -p
index a6ecf48dfdff2ac43eb6370041a49be2fd394681..a78f2113e34da2dba57b03e6efb048b305fef9f3 100644 (file)
@@ -22,6 +22,7 @@ AS86                := @AS86@
 LD86                := @LD86@
 BCC                 := @BCC@
 IASL                := @IASL@
+FETCHER             := @FETCHER@
 
 # Extra folder for libs/includes
 PREPEND_INCLUDES    := @PREPEND_INCLUDES@
index 6292a264c3859400c186e5ad3c1b85f42b0d84d2..edf42f6b0d50e639e2b0acfc3430fb4fa390639e 100755 (executable)
@@ -606,6 +606,9 @@ libgcrypt
 EXTFS_LIBS
 system_aio
 zlib
+FETCHER
+FTP
+WGET
 glib_LIBS
 glib_CFLAGS
 PKG_CONFIG_LIBDIR
@@ -2392,6 +2395,8 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
 
 
 
+
+
 # Enable/disable options
 
 # Check whether --enable-githttp was given.
@@ -6095,6 +6100,108 @@ $as_echo "yes" >&6; }
 
 fi
 
+# Extract the first word of "wget", so it can be a program name with args.
+set dummy wget; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_WGET+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $WGET in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_WGET="$WGET" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_WGET="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_WGET" && ac_cv_path_WGET="no"
+  ;;
+esac
+fi
+WGET=$ac_cv_path_WGET
+if test -n "$WGET"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $WGET" >&5
+$as_echo "$WGET" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+if test x"$WGET" != x"no"; then :
+
+    FETCHER="$WGET -c -O"
+
+else
+
+    # Extract the first word of "ftp", so it can be a program name with args.
+set dummy ftp; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_FTP+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  case $FTP in
+  [\\/]* | ?:[\\/]*)
+  ac_cv_path_FTP="$FTP" # Let the user override the test with a path.
+  ;;
+  *)
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+    ac_cv_path_FTP="$as_dir/$ac_word$ac_exec_ext"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+  test -z "$ac_cv_path_FTP" && ac_cv_path_FTP="no"
+  ;;
+esac
+fi
+FTP=$ac_cv_path_FTP
+if test -n "$FTP"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FTP" >&5
+$as_echo "$FTP" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+    if test x"$FTP" != x"no"; then :
+
+        FETCHER="$FTP -o"
+
+else
+
+        as_fn_error $? "cannot find wget or ftp" "$LINENO" 5
+
+fi
+
+fi
+
+
+
 # Checks for libraries.
 ac_fn_c_check_header_mongrel "$LINENO" "bzlib.h" "ac_cv_header_bzlib_h" "$ac_includes_default"
 if test "x$ac_cv_header_bzlib_h" = x""yes; then :
index 3318fea958aab63a7891e8bd8f6d20cb51d7cec3..e708f015deac23610588130627bb933f5056bd1f 100644 (file)
@@ -35,6 +35,7 @@ m4_include([m4/curses.m4])
 m4_include([m4/pthread.m4])
 m4_include([m4/ptyfuncs.m4])
 m4_include([m4/extfs.m4])
+m4_include([m4/fetcher.m4])
 
 # Enable/disable options
 AX_ARG_DEFAULT_DISABLE([githttp], [Download GIT repositories via HTTP])
@@ -117,6 +118,7 @@ esac
  AX_CHECK_UUID
  AX_CHECK_CURSES
 PKG_CHECK_MODULES(glib, [glib-2.0 >= 2.12])
+AX_CHECK_FETCHER
 
 # Checks for libraries.
 AC_CHECK_HEADER([bzlib.h], [
index a195888dff21ad36ca711abdd8ffb6a82710d039..15561fc0a8c8cc29227594bae4fd036b291aebbf 100644 (file)
@@ -28,7 +28,7 @@ all: $(ROMS)
        $(MAKE) -C $D/src bin/$(*F).rom
 
 $T:
-       if ! wget -O _$T $(IPXE_TARBALL_URL); then \
+       if ! $(FETCHER) _$T $(IPXE_TARBALL_URL); then \
                $(GIT) clone $(IPXE_GIT_URL) $D.git; \
                (cd $D.git && $(GIT) archive --format=tar --prefix=$D/ \
                $(IPXE_GIT_TAG) | gzip >../_$T); \